home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 110 / EnigmaAmiga110CD.iso / dalla rivista / host contacted / awinquake_src.readme < prev    next >
Text File  |  2000-03-19  |  11KB  |  261 lines

  1. Short:    Source code of awinquake 0.8, a68k/ppc
  2. Author:   Peter McGavin  (p.mcgavin@irl.cri.nz)
  3. Uploader: Peter McGavin  (p.mcgavin@irl.cri.nz)
  4. Version:  0.8
  5. Type:     game/shoot
  6.  
  7.  
  8. This archive contains the SAS/C Amiga source code of awinquake and
  9. awinquakeppc 0.8.  You don't need it to play winquake or awinquakeppc,
  10. only if you want to try and compile it or look at how it works.
  11.  
  12. awinquake was derived from the original ID Software Linux winquake
  13. source which you can download from:
  14.  
  15.    ftp://ftp.cdrom.com/pub/idgames/idstuff/source/q1source.zip
  16.  
  17. My modified source code should still compile for Linux (APUS),
  18. Solaris, Win95, etc, with no changes --- untested.  All winquake
  19. support files for those platforms are included in this archive,
  20. even though they are not used by the Amiga version.
  21.  
  22.  
  23. ------------------------------------------------------------------------
  24. v0.8        3 Mar 2000
  25.  
  26. snd_amiga.c, snd_mix.c, snd_dma.c: Implemented AHI support using AHI
  27. device interface with double-buffering.  Had problems reducing the
  28. number of context switches.  Use PPC timer to work out approximately
  29. when each AHI request will finish, then poll with CheckIO() after
  30. that.  Because AHI requests are queued, it's difficult finding out
  31. exactly when they started.  When timed from the PPC side, AHI requests
  32. that should take at least 5.944 seconds to complete inexplicably seem
  33. to finish about 0.02 to 0.08 seconds before that.  Therefore I allow
  34. 0.1 seconds of slop in the code.  Timed from the m68k side, they
  35. finish at the expected time.  Right now I have no explanation for the
  36. discrepancy.
  37.  
  38. sys_amiga.c: More changes to PLL code.  Hopefully this is the last
  39. time and it works in all circumstances now.
  40.  
  41. d_scan.c: Rearranged middle-level loop of D_DrawSpans8() to
  42. precalculate z = 0x10000 / zi for the next loop just before the inner
  43. rendering loop.  So now the FDIV runs in the FPU in parallel with the
  44. inner rendering loop, instead of delaying it.  Modified
  45. amiga_ppc_d_scan.s similarly.  Made other minor changes to inner
  46. loops, gaining 0.1 fps.
  47.  
  48. r_surf.c: R_DrawSurfaceBlock8_mip*(): Made lightleft, lightright,
  49. lightleftstep, lightrightstep and colormap all locals instead of
  50. static.  Also copied vid.colormap, sourcetstep and surfrowbytes into
  51. locals.  Gained 0.4 fps.  I don't think I could beat the code
  52. generated by gcc for R_DrawSurfaceBlock8_mip*() in hand-assembly now.
  53.  
  54. r_edge.c: R_LeadingEdge(): Moved local variables to make them even
  55. more local, i.e, inside if-statements and loops.  Gained 0.2 fps.
  56.  
  57. r_draw.c: R_ClipEdge(): Tried the same trick as above, but it didn't
  58. seem to achieve anything.
  59.  
  60. d_*.c, r_*.c: John Selck sent me some m68k assembly code for lots of
  61. rendering routines.  Added new files amiga_d_68k.c and amiga_r_68k.c.
  62. Inserted #ifdef around routines that are replaced with assembly
  63. equivalents.  Assembly replacements for R_ClipEdge() and R_EmitEdge()
  64. didn't work, so didn't use those ones.
  65.  
  66.  
  67. ------------------------------------------------------------------------
  68. v0.7       19 Feb 2000
  69.  
  70. amiga_ppc_mathlib.s: Stupid bug in sqrt() introduced at the last
  71. minute in v0.6 made the player virtually uncontrollable.  Fixed.
  72.  
  73.  
  74. ------------------------------------------------------------------------
  75. v0.6       18 Feb 2000
  76.  
  77. Some ELF loaders couldn't load awinquakeppc v0.5 because various
  78. global symbols declared in amiga_socket_lib.s and amigacgxtagfns.s had
  79. no type declared.  Goodness knows how it worked in v0.4.  Anyway,
  80. added ".type symbol,@function" declarations to those files.  Also
  81. added ".size" directives to the end of each routine.
  82.  
  83. Added optimised c2p for 68k version.  Used Aki Laukkanen's
  84. 68060-optimised c2p routine from ADoom.
  85.  
  86. cd_audio.c: Continue without CD audio if cdplayer.library fails to
  87. open.
  88.  
  89. sys_amiga.c: Added more PLL cases to awinquakeppc bus speed calc.  See
  90. http://members.xoom.com/silicon/docs/ppc_pll.html.
  91.  
  92. vid_amiga.c: Aspect ratio fix accounts for LACE, HIRES and SUPERHIRES
  93. in native modes using code of John Selck.
  94.  
  95. vid_amiga.c: Added -directcgx option and code to handle it.  Also
  96. required change to quakedef.h and new routines VID_LockBuffer() and
  97. VID_UnlockBuffer().
  98.  
  99. d_ifacea.h and r_shared.h: Increased maximum allowed resolution from
  100. 1280x1024 to 1600x1280.
  101.  
  102. Added new file amiga_ppc_stubs.h included from vid_amiga.c.  Declared
  103. special inline versions of WritePixelArray8() and ReplyMsg() with
  104. optimised cache modes.  This increased overall speed of awinquakeppc
  105. by approximately 0.6 fps with ppc.library.
  106.  
  107. smakefile: Now compile awinquakeppc CPU-intensive routines with GCC
  108. 2.95.2 from http://munk.home.pages.de/.  Now runs at 38.9 fps in
  109. 320x200 for "timedemo demo2".
  110.  
  111. Wrote some hand-optimised PPC assembly routines for awinquakeppc.  New
  112. files are amiga_ppc_d_scan.s and amiga_ppc_mathlib.s.  Added #ifdef to
  113. d_scan.c and mathlib.c.  Speed increased to 40.5 fps.  Found that the
  114. most important inner-loops are already as fast as possible without
  115. changing the algorithms, i.e, memory speed bound.  Almost all of the
  116. speedup came from optimising the middle-level loop of D_DrawSpans8().
  117. All the effort I put into D_DrawZSpans(), VectorNormalize(), Length()
  118. and mysqrt() seems to have made negligible difference.  Sorry, my
  119. assembly routines don't work with StormC or VBCC yet because those
  120. compilers use different conventions from GCC for accessing static
  121. variables.  So only awinquakeppc benefits so far.
  122.  
  123. ------------------------------------------------------------------------
  124. v0.5       30 Jan 2000
  125.  
  126. sys_amiga.c: Memory heap was allocated twice.  Oops.  Fixed.
  127.  
  128. sys:amiga.c: Fixed return value of main().
  129.  
  130. in_amiga.c: Added joypad support and improved mouse support using
  131. Jarmo Laukkonen's WarpQuake source code as an example.  Variable
  132. mouse_has_moved is set in vid_amiga.c.
  133.  
  134. Tried compiling WarpOS PPC version with StormC.  Changes required:
  135.  
  136. common.h: redefine qboolean, false and true
  137.  
  138. console.c: use fopen(), fwrite(), fclose(), remove() instead of
  139. open(), write(), close(), unlink().
  140.  
  141. net.h, net_main.c, net_dgrm.c: use prototypes for procedure function
  142. variable.
  143.  
  144. Copied writechunkypixels_stub.c, cybergraphics_protos_stub.c,
  145. cdplayer_protos_stub.c and lowlevel_protos_stub.c from other projects.
  146.  
  147. Created project file awinquakewos.¶.  The smakefile also works.
  148.  
  149. StormC version works, but rather slow.
  150.  
  151. Tried compiling WarpOS PPC version with vbcc.  Changes required:
  152.  
  153. All *.c and *.h files: Remove ^Ms with dos2unix.
  154.  
  155. console.c, sys_amiga.c, vid_amiga.c and cd_amiga.c: Various #ifdef __VBCC__
  156.  
  157. r_alias.c: vbccwos generates bad code for the assignment "pauxverts =
  158. &auxverts[0]" in R_AliasDrawModel.  As a workaround, made auxverts[]
  159. static for vbcc in r_alias.c.
  160.  
  161. sys_amiga.c: vbcc incorrectly parses the double constant 4294967296.0
  162. in source code.  Replaced with (2147483648.0 + 2147483648.0).
  163.  
  164. For vbccwos, compiled a few inner-loop files with -O3.  However vbcc
  165. generated bad code for r_draw.c and maybe r_bsp.c at that level of
  166. optimisation.  Compiled most files for vbccwos with -O1.
  167.  
  168. mathlib.c: Both StormC and VBCC rounded results differently to SAS/C,
  169. GCC and EGCS in anglemod().  The result was the player's view slowly
  170. drifted when compiled with StormC or VBCC.  Made correction in
  171. anglemod().
  172.  
  173.  
  174. ------------------------------------------------------------------------
  175. v0.4       11 Jan 2000
  176.  
  177. vid_amiga.c: Call cybergraphics.library WritePixelArray() instead of
  178. WriteChunkyPixels() under KS3.0 (provided cgx lib is open).
  179.  
  180. sys_amiga.c: PPCGetAttr (PPCINFOTAG_CPUPLL) appears to return the PLL
  181. code in the high nibble.  Calculated bus speed is more likely to be
  182. right now.
  183.  
  184. common.c and host.c: Made more changes to handling of ':' and '/' and
  185. directory paths.
  186.  
  187. Created in_amiga.c from in_null.c.  Support -mouse and -mousepointer.
  188. Changes to IDCMP message handling in vid_amiga.c.
  189.  
  190. sys_amiga.c: Changed handling of PLL for calculating bus speed.
  191. Hopefully it's right now.
  192.  
  193. sys_amiga.c: Call Host_Shutdown() on exit.  Config.cfg is written now.
  194.  
  195.  
  196. ------------------------------------------------------------------------
  197. v0.3        4 Jan 2000
  198.  
  199. v0.2 called BestCModeIDTags() even if cybergraphics.library failed to
  200. open.  That caused crashes and other problems on Amigas without
  201. cybergraphics.library.
  202.  
  203. The SAS/C __AMIGADATE__ macro generates the string (4/1/0) for 4th Jan
  204. 2000, instead of (4/1/100).
  205.  
  206.  
  207. ------------------------------------------------------------------------
  208. v0.2       30 Dec 1999
  209.  
  210. Wrote sys_amiga.c, vid_amiga.c, snd_amiga.c, cd_amiga.c and
  211. net_amigaudp.c starting with copies of sys_null.c, vid_null.c,
  212. snd_null.c, cd_null.c and net_udp.c, mainly by cutting and pasting
  213. from other projects.
  214.  
  215. Created smakefile.
  216.  
  217. PPC assembly files copied from other projects are: amiga_timer.s,
  218. amiga_cgxtagfns.s and amiga_socket_lib.s.  Also created
  219. cdplayer_pragmas.h.  It goes in ppcinclude:ppcpragmas.
  220.  
  221. Used includes and libs from SDKs for cybergraphics, AmiTCP and
  222. cdplayer.library, all on Aminet.
  223.  
  224. d_edge.c: commented out declaration of screenwidth (conflict with
  225. declaration in r_main.c).
  226.  
  227. d_local.h: made sadjust, tadjust, bbextents, bbextentt and prealspandrawer
  228. all extern to avoid duplicate definitions of symbols.
  229.  
  230. chase.c: declared SV_RecursiveHullCheck as extern.
  231.  
  232. host_cmd.c: declared SV_SaveSpawnparms as extern.
  233.  
  234. net_dgrm.c: don't #define BAN_TEST
  235.  
  236. common.c: deal with '/' in filenames in calls to COM_AddGameDirectory()
  237.  
  238. SAS/C 6.58 appears to generate bad code for R_TransformFrustum() in
  239. r_misc.c when optimisations are turned on.  Split r_misc.c into 2
  240. separate files, r_misc1.c and r_misc2.c, the latter containing only
  241. R_TransformFrustum().  Compiled r_misc2.c as a special case without
  242. optimisation.
  243.  
  244. Had a lot of trouble debugging amigaudp networking code.  Tracked down
  245. 2 problems after a full day of debugging.  The first was that the
  246. wrong errno variable was being picked up.  Replaced references to
  247. errno with calls to bsdsocket.library Errno().  The 2nd problem was in
  248. UDP_AddrCompare().  The original code compared addr1->sa_family with
  249. addr2->sa_family.  Because of the way chars are aligned in the
  250. sockaddr_in structure, this included an uninitialised byte.  Changed
  251. to compare ((struct sockaddr_in *)addr)->sin_family instead.  Finished
  252. up changing all occurrences of addr->sa_family to ((struct sockaddr_in
  253. *)addr)->sin_family.
  254.  
  255. Compiled some low-level rendering modules with ppc-amigaos-gcc instead
  256. of scppc.  Overall speed increased by about 3%.  Discovered that
  257. R_DrawSolidClippedSubmodelPolygons() was truncated by scppc to
  258. R_DrawSolidClippedSubmodelPolygo() and wouldn't link with untruncated
  259. references generated by ppc-amigaos-gcc.  Fixed by truncating the name
  260. in the source code in r_bsp.c, r_main.c and r_local.h.
  261.